package testDataGenerator.model.dataType;

import testDataGenerator.model.DataType;

public class IntegerType implements DataType {
	private int value;

	public IntegerType() {

	}

	public IntegerType(String value) {
		this.value = new Integer(value).intValue();
	}

	// @Override
	public String next(int step) {
		return new Integer(value + step).toString();
	}

	// @Override
	public String random() {
		return null;
	}

	// @Override
	public String rangedRandom(String low, String high) {
		int start = new Integer(low).intValue();
		int end = new Integer(high).intValue();
		return new Integer(randomInt(start, end)).toString();
	}

	// @Override
	public String getName() {
		return "Integer";
	}

	private int randomInt(int start, int end) {
		int len = end - start;
		int random = (int) (Math.random() * (len - 1) + 1);
		return random + start;
	}

	public void minus(int step) {
		this.value = this.value - step;
	}

}
